#include "CrazyRocketManager.h"
#include "global/GlobalPath.h"
#include "global/GlobalDefine.h"

CrazyRocketManager::CrazyRocketManager(){
	m_rocket = NULL;
	m_moveController = NULL;
}

CrazyRocketManager::~CrazyRocketManager(){

}

bool CrazyRocketManager::init(){
	bool bRet = false;
	do 
	{
		CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();

		m_rocket = Rocket::create();

		CCSprite* rocketSprite = CCSprite::create(PATH_PNG_SPRITE_rocket_main);
		m_rocket->bindSprite(rocketSprite);
		m_rocket->bindSprite(CCArmature::create("rocket"));
		m_rocket->getArmature()->getAnimation()->playByIndex(0);

		m_rocket->setPosition(ccp(visibleSize.width/2 ,rocketSprite->getContentSize().height));
		this->addChild(m_rocket);

		m_moveController = Box2dMoveController::create(m_rocket);
		m_rocket->setMoveController(m_moveController);

		bRet = true;
	} while (0);
	return bRet;
}

Box2dMoveController* CrazyRocketManager::getBox2dMoveController(){
	return m_moveController;
}